<template>
  <div>
    <li v-for="(item,index) in arr" :key="index">
      {{item}} <button @click="deletefn(index)">删除</button>
    </li>
    <button @click="createfn">生成</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr: [7, 9, 8, 0]
    }
  },
  methods: {
    createfn () {
      this.arr.push(Math.ceil(Math.random() * 10))
    },
    deletefn (ind) {
      this.arr.splice(ind, 1)
    }
  }
}
</script>

<style>

</style>
